/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.invoice.busines;

import com.invoice.busines.dto.InventarioDTO;
import com.invoice.exceptions.InvoiceException;
import com.invoice.model.dao.InventarioDAO;
import com.invoice.model.dao.InventarioDAOHibernate;
import java.util.List;

/**
 *
 * @author laura
 */
public class InventarioBOImpl implements InventarioBO{
    InventarioDAO inventarioDAO = new InventarioDAOHibernate();
    @Override
    public InventarioDTO addInventario(InventarioDTO inventarioDTO) throws Exception {
        Integer id = (Integer)inventarioDAO.add(inventarioDTO);
        inventarioDTO.setIdInventario(id);
        return inventarioDTO;
    }

    @Override
    public void updateInventario(InventarioDTO inventarioDTO) throws Exception {
        inventarioDAO.update(inventarioDTO);
    }

    @Override
    public List<InventarioDTO> findAll() throws Exception {
        return inventarioDAO.findAll();
    }

    @Override
    public List<InventarioDTO> findByModalidad(Character modalidad) throws Exception {
        return inventarioDAO.findByModalidad(modalidad);
    }
    
    @Override
    public void delete(InventarioDTO inventarioDTO) throws InvoiceException {
        inventarioDAO.delete(inventarioDTO);
    }
}
